Imports System.Data.OleDb
Public Class DataProvider2
    Private _strCon As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data source=CSDL.mdb"
    Public Function Execute(ByVal strSQL As String) As DataTable
        Dim dt As DataTable
        Dim m_Dataset As New DataSet()
        Dim m_OleDbConnection As New OleDbConnection(_strCon)
        Dim m_OleDbDataAdapter As New OleDbDataAdapter()
        m_OleDbDataAdapter.SelectCommand = New OleDbCommand(strSQL, m_OleDbConnection)
        m_OleDbDataAdapter.Fill(m_Dataset)
        m_OleDbConnection.Close()
        dt = m_Dataset.Tables(0)
        Return dt
    End Function
    Public Function ExecuteNonQuery(ByVal strSQL As String) As Integer
        Dim n As Integer
        Dim m_OleDbConnection As New OleDbConnection(_strCon)
        Dim m_OleDBCommand As New OleDbCommand(strSQL, m_OleDbConnection)
        m_OleDbConnection.Open()
        n = m_OleDBCommand.ExecuteNonQuery()
        m_OleDbConnection.Close()
        Return n
    End Function
End Class

